package com.xiaomai.oss.controller;

import com.xiaomai.commonutil.R;
import com.xiaomai.oss.service.impl.OssServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

@RestController
@RequestMapping("/eduoss/fileoss")

public class OssController {
    @Autowired
    private OssServiceImpl ossService;
    @PostMapping
    public R upload(MultipartFile file){
      String url =  ossService.upload(file);
      return R.ok().data("url",url);
    }
}
